package cn.buk.tms.hotel.dto;

import java.util.ArrayList;
import java.util.List;

/**
 *
 * @author yfdai
 */
public class HotelRatePlanDto {

    /**
     * 售卖房型id
     */
    private int roomId;

    /**
     * 售卖房型名称
     */
    private String roomName;

    private int roomTypeId;

    private String roomTypeName;

    /**
     * 一间客房可以入住的最大客人数
     */
    private int maxAdultCount;

    private List<HotelRatePlanRateDto> rates = new ArrayList<>();

    private List<HotelRatePlanCancelPolicyDto> cancelPolicies = new ArrayList<>();

    /**
     * 价格计划的可售状态
     * @return
     */
    public int getSaleStatus() {
        int saleStatus = 0;
        for(HotelRatePlanRateDto rateDto: getRates()) {
            if (rateDto.getSaleStatus() == 0) {
                return 0;
            } else  {
                saleStatus = rateDto.getSaleStatus();
            }
        }

        return saleStatus;
    }


    public List<HotelRatePlanRateDto> getRates() {
        if (rates == null) {
            rates = new ArrayList<>();
        }
        return rates;
    }

    public void setRates(List<HotelRatePlanRateDto> rates) {
        this.rates = rates;
    }


    public int getRoomId() {
        return roomId;
    }

    public void setRoomId(int roomId) {
        this.roomId = roomId;
    }

    public String getRoomName() {
        return roomName;
    }

    public void setRoomName(String roomName) {
        this.roomName = roomName;
    }

    public void setRoomTypeName(String roomTypeName) {
        this.roomTypeName = roomTypeName;
    }

    public String getRoomTypeName() {
        return roomTypeName;
    }

    public int getRoomTypeId() {
        return roomTypeId;
    }

    public void setRoomTypeId(int roomTypeId) {
        this.roomTypeId = roomTypeId;
    }

    public List<HotelRatePlanCancelPolicyDto> getCancelPolicies() {
        if (cancelPolicies == null) {
            cancelPolicies = new ArrayList<>();
        }
        return cancelPolicies;
    }

    public void setCancelPolicies(List<HotelRatePlanCancelPolicyDto> cancelPolicies) {
        this.cancelPolicies = cancelPolicies;
    }

    public int getMaxAdultCount() {
        return maxAdultCount;
    }

    public void setMaxAdultCount(int maxAdultCount) {
        this.maxAdultCount = maxAdultCount;
    }
}
